package cn.openea.perpartner.componet.web.enums;

import cn.hutool.json.JSONObject;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Weird077
 * @description TODO
 * @date 2023-05-25 13:56
 */
public enum ScopeEnums {
    ALL("all", "customerService","全部"),
    PROVIDER("provider", "providerService","区域服务商"),
    EVALUATOR("evaluator", "personalInfoService","测评师");
    private final String scope;
    private final String beanName;

    private final String context;

    ScopeEnums(String scope, String beanName,String context) {
        this.scope = scope;
        this.beanName = beanName;
        this.context = context;
    }

    public static String getBeanName(String scope) {
        for (ScopeEnums enums : values()) {
            if (enums.scope.equals(scope)) {
                return enums.beanName;
            }
        }
        return ScopeEnums.ALL.beanName;
    }

    public static List<JSONObject> getScopeEnums() {
        List<JSONObject> list = new ArrayList<>();
        for (ScopeEnums enums : values()) {
            JSONObject object = new JSONObject();
            object.put("scope", enums.scope);
            object.put("beanName", enums.beanName);
            object.put("context", enums.context);
            list.add(object);
        }
        return list;
    }
}
